<?php
session_start();
if ( ( isset( $_SESSION['ip'] ) ) && ( isset( $_SESSION['port'] ) ) )
{
	include("LU.Class.php");
	$q = new LUQuery($_SESSION['ip'],$_SESSION['port']);
	if ($q->IsAlive()) {
		$data = $q->GetInfo();
		if ($data["ServerPlayers"] >= 1)
		{
			echo '<table><thead><tr><th>ID</th><th>Nickname</th><th>Ping</th><th>Info</th></tr></thead><tbody>';
			for($i = 1; $i <= $data["ServerPlayers"]; $i++)
			{
				echo '<tr class="player">';
				if (isset($data["Player"][$i]["ID"])) echo '<td>' . $data["Player"][$i]["ID"] . '</td>';
				if (isset($data["Player"][$i]["Nick"])) echo '<td>' . $data["Player"][$i]["Nick"] . '</td>';
				if (isset($data["Player"][$i]["Ping"])) echo '<td>' . $data["Player"][$i]["Ping"] . '</td>';
				echo '<td><a type="button" class="blue PlayerInfo" href="MoreInfo.php?id='.$data['Player'][$i]["ID"].'">Info</a></td>';
				echo '</tr>';
			}
			echo '</tbody></table>';
		}
		else echo '<center>Server is empty.</center>';
	}
	else echo "OFF";
}
else echo "OFF";
?>